<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box">
        <navbar>
            <template v-slot:left>
                <div>
                    <span>
                        &lt;</span>
                    <span>返回</span>
                </div>
            </template>
            <template v-slot:middle>
                <div>
                    标题
                </div>
            </template>
            <template v-slot:right>
                <div>
                    <img width="25px" src="seach.png" alt="">
                </div>
            </template>
        </navbar>

    </div>
    <script src='./js/vue.js'></script>
    <script>
        Vue.component("navbar", {
            //组件中使用slot插槽来存放实例中的按钮
            template: `
                    <div style="display:flex;justify-content: space-around;">
                        <slot name="left"></slot>
                        <slot name="middle"></slot>
                        <slot name="right"></slot>
                    </div>  
               `
        })
        var vm = new Vue({
            el: "#box",
            data: {}
        })
    </script>
</body>

</html>